<script>

	function cancel(){
		window.close();
	}
	function cetak(){
		$('#printarea').siblings().addClass("no_print");
		$('#printarea').parents().siblings().addClass("no_print");
		window.print();
		//$('#printarea').siblings().removeClass("no_print");
		//$('#printarea').parents().removeClass("no_print");
	}
	function excel(){
		var url='<?php echo "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>&output=excel';
		//alert(url);
		var iframe;
	  	iframe = document.getElementById("hiddenDownloader");
		if (iframe === null)
		{
			iframe = document.createElement('iframe');  
		    iframe.id = "hiddenDownloader";
		    iframe.style.visibility = 'hidden';
		    document.body.appendChild(iframe);
		}
		iframe.src = url;
		//document.body.removeChild(iframe);
	}
</script>

<div style="border-bottom:2px solid #000;padding-bottom:5px;margin-bottom:20px">
<?php 
	$this->widget('application.components.widgets.ActionBar', 
		array("menuAlign" => "right", 
			'items' => array(
				array(
					'id' => "btnPrint",
					'title' => "Cetak",
					'icon' => "images/action/Actions-print-icon.png",
					'callback'=>"cetak"
				),
				array(
						'id' => "btnExcel",
						'title' => "Excel",
						'icon' => "images/action/Action-excel.png",
						'callback'=>"excel"
				),
				array(
					'id' => "btnCancel",
					'title' => "Batal",
					'icon' => "images/action/Actions-dialog-cancel-icon.png",
					'callback'=>"cancel"
				),
			)
		)
	);
?>
</div>
<div id="printarea" >

<?php 
if(count($data)>0){
	echo "<table>";
	echo "<tr><th>Nama</th><th>Keterangan</th><th>Status</th></tr>";
	$counter=1;
	foreach($data as $row){
		if(($counter%2)==1)
			echo "<tr class='rowganjil'>";
		else
			echo "<tr class='rowgenap'>";
		$counter++;
		
		echo "<tr>";
		echo "<td>".$row['name']."</td><td>".$row['description']."</td><td>".$row['is_active']."</td>";
		echo "</tr>";
	}
	echo "</table>";
}
?>
</div>
